package com.muke.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created with IntelliJ IDEA.
 * Date: 2019-10-9.
 * Time: 14:41.
 * Explain:
 *
 * @author hezx
 */
@Getter
@AllArgsConstructor
public enum SecKillEnums {
    SUCCESS(1, "秒杀成功"),
    END(0, "秒杀已结束"),
    REPEAT_SKILL(-1, "重复秒杀"),
    INNER_ERROR(-2, "内部异常"),
    REWRITE(-3, "数据篡改");

    //状态
    private Integer state;
    //执行信息
    private String stateInfo;

    public static SecKillEnums stateInfo(int index) {
        for (SecKillEnums enums : values()) {
            if (enums.getState() == index)
                return enums;
        }
        return null;
    }
}
